package com.ruoyi.web.controller.sequence;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.zhuangxiumain.orderformMain.OrderMaster;
import com.ruoyi.system.domain.zhuangxiumain.shopMain.ProductInfo;
import com.ruoyi.system.service.zhaungxiuservice.shopService.ProductInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/dianpu")
public class DianPuController extends BaseController {

    @Autowired
    private ProductInfoService productInfoService;

    @GetMapping(value = "/dianpuList")
    public TableDataInfo dianpuList(ProductInfo productInfo){
        startPage();
        List<ProductInfo> list = productInfoService.dianpuList(productInfo);
        return getDataTable(list);
    }

    @GetMapping(value = "/dianpuid/{productId}")
    public AjaxResult getInfo(@PathVariable("productId") Integer productId)
    {
        return AjaxResult.success(productInfoService.selectProductInfoById(productId));
    }


    @PutMapping(value = "/dianpuedit")
    public AjaxResult edit(@RequestBody ProductInfo productInfo)
    {
        return toAjax(productInfoService.updateProductInfo(productInfo));
    }




}
